package 双指针;

import java.util.Scanner;

public class test1 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = in.nextInt();
        }
        test1 test1 = new test1();
        test1.moveZeroes(nums); //实例化
    }
    public void moveZeroes(int[] nums) {
        int n = nums.length;
        for (int i = 0,index=-1; i < n; i++) {
            if(nums[i]!=0){
                index++;
                int tmp = nums[index];
                nums[index] = nums[i];
                nums[i] = tmp;
            }
        }
    }

}
